from django.db import models
from django.forms import ModelForm
from django.contrib.auth.models import User


class DatFile(models.Model):
    """Model for storing EnergyPro dat files."""
    user = models.ForeignKey(
        User,
        null=True,
        blank=True,
    )
    dat_file = models.FileField(
        upload_to = "dat_files",
        help_text = "Select the EnergyPro dat file you want to process.",
    )


class DatFileForm(ModelForm):
    """Form for uploading EnergyPro dat file."""
    class Meta:
        model = DatFile
        fields = ('dat_file',)
